> x<-rnorm(100)
> y<-3*x+2+0.5*rnorm(100)
> plot(x,y)
> z<-lm(y~x)
> z

Call:
lm(formula = y ~ x)

Coefficients:
(Intercept)            x  
      1.998        2.939  

> plot(z)
   ...

> plot(z)

> summary(z)

Call:
lm(formula = y ~ x)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.09254 -0.31377 -0.01438  0.32801  1.64821 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  1.99840    0.05167   38.67   <2e-16 ***
x            2.93903    0.05554   52.91   <2e-16 ***
---
Signif. codes:  0 *** 0.001 ** 0.01 * 0.05 . 0.1   1 

Residual standard error: 0.5167 on 98 degrees of freedom
Multiple R-squared: 0.9662,     Adjusted R-squared: 0.9658 
F-statistic:  2800 on 1 and 98 DF,  p-value: < 2.2e-16 

> read.data(file.choose(),header=TRUE)
:     "read.data"
> ?read.csv
starting httpd help server ... done
> read.table(file.choose(),header=TRUE)
   AD1  AD2 VALUE V1 V2 V3 V4  V5 V6 V7 V8 V9
1   13   80 66938  3  0  1 15  81  8 19  0 18
2   24   48 70585  4  0  2 10  41 10  9  0 15
3   32   81 33579  2  0  2  0  78  7 33  0 19
4   41  116 44191  4  1  3  5 137 10 30 10 25
5   44   38 53919  3  2  2 10 131  7 12 14 27
6   44  117 61853  1  0  2 10   9  4  0  0  5
7   48  131 65428  4  2  3  5  86  5 23 12 21
8   51   55 86091  3  0  1 10  19  3  5  0  9
9   53  149 49251  1  0  1  5   0  0  0  0  0
10  53  394 42862  3  0  1  0  13  3  0  0  8
11  56  158 97995  3  0  2 15  60  2 38  0  7
12  57  211 85675  4  0  3 15  43  4 15  0 13
13  57  837 82886  2  1  2 10  34  4  0 10 10
14  58 1051 54012  2  0  1  5  19  3  4  0 12
15  63 1256 49541  1  0  2  5   6  2  0  0  2
16  65  556 58839  2  1  1  5  49  4 11  7 14
17  67  667 78739  1  0  4  5  37  2 20  0  0
18  68   28 80885  2  0  2 15  46  6 20  0 15
19  71  369 89273  2  1  2 15  34  4  5  3 13
20  75  269 71427  2  1  1 15  86  8 30 14 15
> da<-read.table(file.choose(),header=TRUE)
> da
   AD1  AD2 VALUE V1 V2 V3 V4  V5 V6 V7 V8 V9
1   13   80 66938  3  0  1 15  81  8 19  0 18
2   24   48 70585  4  0  2 10  41 10  9  0 15
3   32   81 33579  2  0  2  0  78  7 33  0 19
4   41  116 44191  4  1  3  5 137 10 30 10 25
5   44   38 53919  3  2  2 10 131  7 12 14 27
6   44  117 61853  1  0  2 10   9  4  0  0  5
7   48  131 65428  4  2  3  5  86  5 23 12 21
8   51   55 86091  3  0  1 10  19  3  5  0  9
9   53  149 49251  1  0  1  5   0  0  0  0  0
10  53  394 42862  3  0  1  0  13  3  0  0  8
11  56  158 97995  3  0  2 15  60  2 38  0  7
12  57  211 85675  4  0  3 15  43  4 15  0 13
13  57  837 82886  2  1  2 10  34  4  0 10 10
14  58 1051 54012  2  0  1  5  19  3  4  0 12
15  63 1256 49541  1  0  2  5   6  2  0  0  2
16  65  556 58839  2  1  1  5  49  4 11  7 14
17  67  667 78739  1  0  4  5  37  2 20  0  0
18  68   28 80885  2  0  2 15  46  6 20  0 15
19  71  369 89273  2  1  2 15  34  4  5  3 13
20  75  269 71427  2  1  1 15  86  8 30 14 15
> z<-lm(VALUE~AD1+AD2)
  eval(expr, envir, enclos) :  'VALUE'  
> ?lm
> ?lm
> z<-lm(VALUE~AD1+AD2,data=da)
> summary(da)
      AD1            AD2              VALUE             V1             V2      
 Min.   :13.0   Min.   :  28.00   Min.   :33579   Min.   :1.00   Min.   :0.00  
 1st Qu.:44.0   1st Qu.:  80.75   1st Qu.:52825   1st Qu.:2.00   1st Qu.:0.00  
 Median :54.5   Median : 153.50   Median :66183   Median :2.00   Median :0.00  
 Mean   :52.0   Mean   : 330.55   Mean   :66198   Mean   :2.45   Mean   :0.45  
 3rd Qu.:63.5   3rd Qu.: 434.50   3rd Qu.:81385   3rd Qu.:3.00   3rd Qu.:1.00  
 Max.   :75.0   Max.   :1256.00   Max.   :97995   Max.   :4.00   Max.   :2.00  
       V3            V4              V5               V6             V7       
 Min.   :1.0   Min.   : 0.00   Min.   :  0.00   Min.   : 0.0   Min.   : 0.00  
 1st Qu.:1.0   1st Qu.: 5.00   1st Qu.: 19.00   1st Qu.: 3.0   1st Qu.: 3.00  
 Median :2.0   Median :10.00   Median : 42.00   Median : 4.0   Median :11.50  
 Mean   :1.9   Mean   : 8.75   Mean   : 50.45   Mean   : 4.8   Mean   :13.70  
 3rd Qu.:2.0   3rd Qu.:15.00   3rd Qu.: 78.75   3rd Qu.: 7.0   3rd Qu.:20.75  
 Max.   :4.0   Max.   :15.00   Max.   :137.00   Max.   :10.0   Max.   :38.00  
       V8              V9       
 Min.   : 0.00   Min.   : 0.00  
 1st Qu.: 0.00   1st Qu.: 7.75  
 Median : 0.00   Median :13.00  
 Mean   : 3.50   Mean   :12.40  
 3rd Qu.: 7.75   3rd Qu.:15.75  
 Max.   :14.00   Max.   :27.00  
> summary(z)

Call:
lm(formula = VALUE ~ AD1 + AD2, data = da)

Residuals:
   Min     1Q Median     3Q    Max 
-25909 -11201  -2576  14857  27024 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept) 43842.96   13627.11   3.217  0.00506 **
AD1           527.94     276.31   1.911  0.07306 . 
AD2           -15.42      12.10  -1.275  0.21946   
---
Signif. codes:  0 *** 0.001 ** 0.01 * 0.05 . 0.1   1 

Residual standard error: 17020 on 17 degrees of freedom
Multiple R-squared: 0.1856,     Adjusted R-squared: 0.08978 
F-statistic: 1.937 on 2 and 17 DF,  p-value: 0.1746 

> 
